let index = 10

while (--index) {
    http(index)
}

const https = []
let httpStatus = true

async function http (index) {
    if (httpStatus) {
        httpStatus = false
        await send(https.shift())
        httpStatus = true
    } else {
        https.push(index)
    }
    
}

function send (index) {
    setTimeout(() => {
        console.log(index)
    }, 1000);
}